<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <!-- general form elements -->
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">编辑分类</h3>
                </div>
                <!-- form start -->
                <form class="form-horizontal layui-form" action="{:url('/admin/article/category/add')}" method="post" enctype="text/plain">
                    <div class="box-body">
                        <input class="form-control" name="id" placeholder="" value="{$category.id|default=0}"
                               type="hidden">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">上级菜单</label>

                            <div class="col-sm-10">
                                <select name="pid" class="form-control">
                                    <option value="0">一级菜单</option>
                                    {volist name="parentcategory" id="vo"}
                                        <option value="{$vo.id}" {eq name="vo.id" value="$category.pid|default=''" }selected{/eq}>{$vo.name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">名称</label>

                            <div class="col-sm-10">
                                <input class="form-control" name="name" placeholder="" value="{$category.name|default=''}"
                                       type="text">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">备注</label>

                            <div class="col-sm-10">
                                <textarea class="form-control" name="remark"
                                          rows="3">{$category.remark|default=''}</textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-md-2">状态</label>

                            <div class="col-md-7">
                                <input type="checkbox" name="status" lay-skin="switch" value="1"
                                {notempty name="category.status"}checked{/notempty}>
                            </div>
                        </div>
                    </div>

                    <div class="box-footer">
                        <div class="col-sm-2">
                            <button type="submit" class="btn btn-block btn-danger">保存</button>
                        </div>

                        <div class="col-sm-2">
                            <button type="button" class="btn btn-block btn-default" onclick="history.go(-1)">取消
                            </button>
                        </div>
                    </div>

                </form>
            </div>
            <!-- /.box -->
        </div>
        <!--/.col (right) -->
    </div>
</section>
<script type="text/javascript">
	$(function () {
		layui.use('form', function() {
            var form = layui.form();
            form.render(); //更新全部
        });
	});
</script>
